<template>
	<view :style="'height:'+tophight.height+'px;'+'line-height:'+tophight.height+'px;'+'top:'+tophight.top+'px;'" class="wx-nav">
		<view @click="goback" class="left-nav-icon">
			<text class="iconfont iconfontText">&#xe6cb;</text>
		</view>
		<text v-if="navTitle" class="navTitle">{{navTitle}}</text>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tophight: null
			}
		},
		props:['navTitle'],
		methods: {
			goback(){
				uni.navigateBack()
			}
		},
		created() {
			//获取胶囊按钮的数据
			this.tophight = uni.getMenuButtonBoundingClientRect()
		},
		mounted() {
			console.log('this.tophight..', this.tophight)
		}
	}
</script>
<style lang="less">
	.wx-nav {
		position: absolute;
		z-index: 11;
		width: 100%;
		text-align: center;
		.left-nav-icon {
			position: absolute;
			left: 31rpx;
		}
		.iconfontText {
			font-size: 30rpx;
			color: #fff;
			display: block;
			padding: 0 30rpx;
		}
		.navTitle {
			font-size: 34rpx;
			color: #fff;
		}
	}
	
	
	
	
</style>
